package com.basin.micro.admin.module.position.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.basin.micro.admin.module.position.pojo.entity.PositionEntity;
import com.basin.micro.admin.module.position.repository.PositionRepository;
import com.basin.micro.admin.module.position.service.PositionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author: Sam ZHONG | sammy1997@aliyun.com
 */
@Service
@Slf4j(topic = "BASIN:ADMIN:POSITION_SERVICE")
@RequiredArgsConstructor
public class PositionServiceImpl implements PositionService {
    private final PositionRepository positionRepository;

    @Override
    public PositionEntity getByCode(String code) {
        return positionRepository.getOne(Wrappers.<PositionEntity>lambdaQuery()
                .eq(PositionEntity::getPositionCode, code));
    }
}
